package xiegd.study.lambda;

import org.junit.Test;

import java.util.Arrays;
import java.util.Comparator;

/**
 * @Description:
 * @Author: xieguangda
 * @Date: 2021年07月06日 14:53
 */
public class LambdaStudy1 {

    @Test
    public void sortTest(){
        String[] oldWay = "Improving code with Lambda expressions in Java 8".split(" ");
        Arrays.sort(oldWay, new Comparator<String>() {
            @Override
            public int compare(String s1, String s2) {
                // 忽略大小写排序:
                return s1.toLowerCase().compareTo(s2.toLowerCase());
            }
        });
        System.out.println(String.join(", ", oldWay));
    }
}
